package com.example.testscalaandroid

import android.os.Bundle
import android.app.Activity
import android.view.Menu
import android.widget.Spinner
import android.view.View.OnClickListener
import android.view.View
import android.widget.TextView
import android.widget.Button

class MainActivity extends Activity {

  protected override def onCreate(savedInstanceState: Bundle) = {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
     butten.setOnClickListener {
      textView1.setText("onclick")
    }
  }

  override def onCreateOptionsMenu(menu: Menu) = {
    getMenuInflater.inflate(R.menu.main, menu)
   
   
    true
  }

  implicit def onClick(fn: View => Unit) = new OnClickListener {
    def onClick(v: View) =
      fn(v)
  }

  implicit def onClick(fn: => Unit): OnClickListener = onClick { _ => fn }

  lazy val spinnerTest = this.findViewById(R.id.spinnerTest).asInstanceOf[Spinner]

  lazy val textView1 = findViewById(R.id.textView1).asInstanceOf[TextView]

  lazy val butten=findViewById(R.id.buttonTest).asInstanceOf[Button]
}